﻿using System.Collections.Generic;
using CustomORM.Tests.CustomORM.Mapping;

namespace CustomORM.Tests.CustomORM
{
    public class ParentEntity
    {
        public int Id { get; set; }
        public string Name { get; set; }

        public List<KidEntity> Kids { get; set; }
    }

    public class KidEntity
    {
        public int Id { get; set; }
        public int ParentId { get; set; }
        public string Name { get; set; }
    } 

    public class ParentEntityMap : EntityToTableMapperExposed<ParentEntity>
    {
        public ParentEntityMap()
        {
            Table("PARENT");
            Id(x => x.Id, "PARENT_ID");
            Map(x => x.Name, "NAME");
            HasMany(x => x.Kids, "PARENT_ID");
        }
    }

    public class KidEntityMap : EntityToTableMapperExposed<KidEntity>
    {
        public KidEntityMap()
        {
            Table("KID");
            Id(x => x.Id, "KID_ID");
            Map(x => x.ParentId, "PARENT_ID");
            Map(x => x.Name, "NAME");
        }
    }
}